import request from '@/utils/request'

/**
 * 查询部门列表
 */
export function getDeptList(query?: any) {
  return request.get('/system/dept/list', query)
}

/**
 * 查询部门列表（排除节点）
 */
export function getDeptListExcludeChild(deptId: number) {
  return request.get(`/system/dept/list/exclude/${deptId}`)
}

/**
 * 查询部门详细
 */
export function getDept(deptId: number) {
  return request.get(`/system/dept/${deptId}`)
}

/**
 * 新增部门
 */
export function addDept(data: any) {
  return request.post('/system/dept', data, {
    showLoading: true,
    showSuccess: true,
    successMsg: '部门新增成功',
  })
}

/**
 * 修改部门
 */
export function updateDept(data: any) {
  return request.put('/system/dept', data, {
    showLoading: true,
    showSuccess: true,
    successMsg: '部门修改成功',
  })
}

/**
 * 删除部门
 */
export function delDept(deptId: number) {
  return request.delete(`/system/dept/${deptId}`, {}, {
    showLoading: true,
    showSuccess: true,
    successMsg: '部门删除成功',
  })
}
